/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bit.entidade;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author marcelo
 */
@Entity
@Table(name = "maquina")
@NamedQueries({@NamedQuery(name = "Maquina.findAll", query = "SELECT m FROM Maquina m"), @NamedQuery(name = "Maquina.findById", query = "SELECT m FROM Maquina m WHERE m.id = :id"), @NamedQuery(name = "Maquina.findByNome", query = "SELECT m FROM Maquina m WHERE m.nome = :nome"), @NamedQuery(name = "Maquina.findByIp", query = "SELECT m FROM Maquina m WHERE m.ip = :ip"), @NamedQuery(name = "Maquina.findByTamanhoMemoria", query = "SELECT m FROM Maquina m WHERE m.tamanhoMemoria = :tamanhoMemoria"), @NamedQuery(name = "Maquina.findByTamanhoDisco", query = "SELECT m FROM Maquina m WHERE m.tamanhoDisco = :tamanhoDisco"), @NamedQuery(name = "Maquina.findByQuantidadeProcessador", query = "SELECT m FROM Maquina m WHERE m.quantidadeProcessador = :quantidadeProcessador")})
public class Maquina implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "nome")
    private String nome;
    @Column(name = "ip")
    private String ip;
    @Column(name = "tamanho_memoria")
    private Integer tamanhoMemoria;
    @Column(name = "tamanho_disco")
    private Integer tamanhoDisco;
    @Column(name = "quantidade_processador")
    private Integer quantidadeProcessador;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idMaquina")
    private Collection<Aplicativo> aplicativoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idMaquina")
    private Collection<MaquinaServico> maquinaServicoCollection;
    @JoinColumn(name = "id_processador", referencedColumnName = "id")
    @ManyToOne
    private Processador idProcessador;

    public Maquina() {
    }

    public Maquina(Long id) {
        this.id = id;
    }

    public Maquina(Long id, String nome) {
        this.id = id;
        this.nome = nome;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Integer getTamanhoMemoria() {
        return tamanhoMemoria;
    }

    public void setTamanhoMemoria(Integer tamanhoMemoria) {
        this.tamanhoMemoria = tamanhoMemoria;
    }

    public Integer getTamanhoDisco() {
        return tamanhoDisco;
    }

    public void setTamanhoDisco(Integer tamanhoDisco) {
        this.tamanhoDisco = tamanhoDisco;
    }

    public Integer getQuantidadeProcessador() {
        return quantidadeProcessador;
    }

    public void setQuantidadeProcessador(Integer quantidadeProcessador) {
        this.quantidadeProcessador = quantidadeProcessador;
    }

    public Collection<Aplicativo> getAplicativoCollection() {
        return aplicativoCollection;
    }

    public void setAplicativoCollection(Collection<Aplicativo> aplicativoCollection) {
        this.aplicativoCollection = aplicativoCollection;
    }

    public Collection<MaquinaServico> getMaquinaServicoCollection() {
        return maquinaServicoCollection;
    }

    public void setMaquinaServicoCollection(Collection<MaquinaServico> maquinaServicoCollection) {
        this.maquinaServicoCollection = maquinaServicoCollection;
    }

    public Processador getIdProcessador() {
        return idProcessador;
    }

    public void setIdProcessador(Processador idProcessador) {
        this.idProcessador = idProcessador;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Maquina)) {
            return false;
        }
        Maquina other = (Maquina) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bit.entidade.Maquina[id=" + id + "]";
    }

}
